package com.job51.hro.datacheckservice.service.jobhandlers;

import com.job51.hro.datacheckservice.service.TJMailService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author pengfei.ma
 * @create 2022/8/1
 * @since 1.0.0
 */
@Service
@Slf4j
public class TJMails {
    @Autowired
    TJMailService tjMailService;

    @XxlJob("sendTJCheckMail")
    public ReturnT<String> sendErrorLogMail(String param) throws Exception {
       int res= tjMailService.sendTJCheckMail();
        String resMessage ;
        if(res ==1) {
            resMessage="邮件发送完毕";
        }else if(res ==0){
            resMessage="未查询到失败邮件，停止发送";
        }else{
            resMessage="邮件发送失败，具体查看错误日志";
        }
        XxlJobLogger.log(resMessage);
        return ReturnT.SUCCESS;
    }
}
